(function($){
	var DEF_PanelOffset = {};
		
	var DEF_control = {
		Panel : {
			PanelClass : '.Panel',
			UserInfo : '.userInfoPanel',
			BattelInfo : '.battelInfoPanel',
			ActionBar : '.actionBarPanel'
		}
	};
	
	var C = function(name) {
		return $(name);
	};
	
	var initPanel = function() {
		C(DEF_control.Panel.PanelClass).each(function() {
			var id = $(this).attr('id');
			var eventFunction = {
				onMove : function(left,top) {
					DEF_PanelOffset[id].top = top;
					DEF_PanelOffset[id].left = left;
					
					$.cookies.set('mst4j_DEF_PanelOffset',getJsonString(DEF_PanelOffset));
				},
				onResize : function(width,height) {
					DEF_PanelOffset[id].width = width;
					DEF_PanelOffset[id].height = height;
					
					$.cookies.set('mst4j_DEF_PanelOffset',getJsonString(DEF_PanelOffset));
				}
			};
			var opts = $.extend({},Def.Dialog,DEF_PanelOffset[id] || {},eventFunction);
			$(this).dialog(opts);
		});
	};
	
	var loadPanelPosition = function() {
		var PanelOffset = $.cookies.get('mst4j_DEF_PanelOffset');

		if(PanelOffset != null)
			DEF_PanelOffset = eval('(' + PanelOffset + ')');
	};
	
	$(document).ready(function() {
		//loadEasyuiFunction();
		loadPanelPosition();
		initPanel();
	});
	
})(jQuery);